﻿<%@ Page MasterPageFile="~/admin/MasterPage.master" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <form id="catContrForm" runat="server">
    <div>    
        <table class="style1" style="width: 102%">
            <tr>
                <td class="style5" style="width: 102px; height: 428px;">
                    &nbsp;<div style="overflow: auto; width: 320px; height: 390px">
                    <asp:TreeView ID="CatTreeView" runat="server" 
                        onselectednodechanged="CatTreeView_SelectedNodeChanged">
                        <DataBindings>
                            <asp:TreeNodeBinding DataMember="category" TextField="name" ValueField="id" />
                        </DataBindings>
                    </asp:TreeView>
                    </div>
                </td>
                <td valign="top" class="style4" style="height: 428px">
                    <table class="style1">
                        <tr>
                            <td class="style3">
                                Имя:</td>
                            <td>
                                <asp:TextBox ID="CatNameTextBox" runat="server" Width="261px"></asp:TextBox>
                                </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                &nbsp;Родительская категория:</td>
                            <td>
                                &nbsp;<asp:DropDownList ID="CatParentDropDownList" runat="server" DataSourceID="CatObjectDataSource"
                                    DataTextField="CategoryName" DataValueField="CategoryId" Width="260px">
                                </asp:DropDownList>
                                <asp:ObjectDataSource ID="CatObjectDataSource" runat="server" SelectMethod="GetCategoryList"
                                    TypeName="DBControl"></asp:ObjectDataSource>
                                <asp:CustomValidator ID="CatParentCustomValidator" runat="server" Display="Dynamic"
                                    ErrorMessage="Нельзя перенести категорию в себя"></asp:CustomValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                            </td>
                            <td>
                                &nbsp;<asp:CheckBox ID="ShortListCheckBox" runat="server" 
                                    Text="Показывать в коротком списке" />
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                &nbsp;</td>
                            <td>
                                <asp:Button ID="InsertButton" runat="server" 
                                    onclick="InsertButton_Click" Text="Создать подкатегорию" Width="193px" />
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                <asp:Button ID="MoveUpButton" runat="server" Enabled="False" 
                                    Text="Переместить вверх" Width="193px" OnClick="MoveUpButton_Click" />
                            </td>
                            <td>
                                <asp:Button ID="UpdateButton" runat="server" Enabled="False" Text="Изменить" 
                                    Width="193px" OnClick="UpdateButton_Click" />
                            </td>
                        </tr>
                        <tr>
                            <td class="style3">
                                <asp:Button ID="MoveDownButton" runat="server" Enabled="False" 
                                    Text="Переместить вниз" Width="193px" OnClick="MoveDownButton_Click" />
                            </td>
                            <td>
                                <asp:Button ID="DeleteButton" runat="server" Enabled="False" 
                                    onclick="DeleteButton_Click" Text="Удалить" Width="193px" />
                                <asp:CustomValidator ID="DeleteCustomValidator" runat="server" Display="Dynamic"
                                    ErrorMessage="Невозможно удалить категорию потому что она не пустая"></asp:CustomValidator></td>
                        </tr>
                    </table>
                    <asp:HiddenField ID="catIdHiddenField" runat="server" />
                    <asp:HiddenField ID="parentCatIdHiddenField" runat="server" />
                    <asp:HiddenField ID="catNameHiddenField" runat="server" />
                    <asp:HiddenField ID="shortListHiddenField" runat="server" />
                    <asp:HiddenField ID="childCountHiddenField" runat="server" />
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</asp:Content>